package com.cencat.user.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 角色权限关联视图对象
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "角色权限关联视图对象")
public class RolePermissionVO {

    /**
     * 角色ID
     */
    @Schema(description = "角色ID", example = "1")
    private Long roleId;

    /**
     * 角色名称
     */
    @Schema(description = "角色名称", example = "管理员")
    private String roleName;

    /**
     * 角色编码
     */
    @Schema(description = "角色编码", example = "admin")
    private String roleCode;

    /**
     * 角色类型：system-系统角色，custom-自定义角色
     */
    @Schema(description = "角色类型", example = "system")
    private String roleType;

    /**
     * 角色状态：0-禁用，1-启用
     */
    @Schema(description = "角色状态", example = "1")
    private Integer roleStatus;

    /**
     * 权限列表
     */
    @Schema(description = "权限列表")
    private List<PermissionInfo> permissions;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "1")
    private Long tenantId;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间", example = "2024-01-01 12:00:00")
    private LocalDateTime createTime;

    /**
     * 创建人
     */
    @Schema(description = "创建人", example = "admin")
    private String createBy;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间", example = "2024-01-01 12:00:00")
    private LocalDateTime updateTime;

    /**
     * 更新人
     */
    @Schema(description = "更新人", example = "admin")
    private String updateBy;

    /**
     * 权限信息内部类
     */
    @Data
    @Schema(description = "权限信息")
    public static class PermissionInfo {

        /**
         * 权限ID
         */
        @Schema(description = "权限ID", example = "1")
        private Long permissionId;

        /**
         * 父权限ID
         */
        @Schema(description = "父权限ID", example = "0")
        private Long parentId;

        /**
         * 权限名称
         */
        @Schema(description = "权限名称", example = "用户管理")
        private String permissionName;

        /**
         * 权限编码
         */
        @Schema(description = "权限编码", example = "user:manage")
        private String permissionCode;

        /**
         * 权限类型：menu-菜单，button-按钮，api-接口
         */
        @Schema(description = "权限类型", example = "menu")
        private String permissionType;

        /**
         * 权限路径
         */
        @Schema(description = "权限路径", example = "/user/manage")
        private String path;

        /**
         * 权限图标
         */
        @Schema(description = "权限图标", example = "user")
        private String icon;

        /**
         * 排序号
         */
        @Schema(description = "排序号", example = "1")
        private Integer sortOrder;

        /**
         * 权限状态：0-禁用，1-启用
         */
        @Schema(description = "权限状态", example = "1")
        private Integer status;

        /**
         * 权限描述
         */
        @Schema(description = "权限描述", example = "用户管理相关权限")
        private String description;

        /**
         * 创建时间
         */
        @Schema(description = "创建时间", example = "2024-01-01 12:00:00")
        private LocalDateTime createTime;
    }
}